<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>8 模板语法-指令</title>
    <script src="https://cdn.jsdelivr.net/npm/axios@0.12.0/dist/axios.min.js"></script>
    <script src="js/vue.global.js"></script>
    <style>
        .static {
            width: 100px;
            height: 100px;
        }
        .active {
            background: green;
        }
        .text-danger {
            background: red;
        }
    </style>
</head>
<body>
<div id="app">
    <div class="static" :class="{ 'active': isActive, 'text-danger': hasError }">
    </div>
</div>

<script>
    const app = {
        data() {
            return {
                isActive: false,
                hasError: true
            }
        }
    }

    Vue.createApp(app).mount('#app')
</script>
</body>
</html>